package com.zoe;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.boot.web.context.WebServerInitializedEvent;
import org.springframework.context.ApplicationListener;
import org.springframework.stereotype.Component;

/**
 * @Author Zoe.Zhang
 * @Date: 2021/09/21
 * @Description
 */
@Component
public class MyApplicationListener implements ApplicationListener<WebServerInitializedEvent> {
    private static final Logger log = LoggerFactory.getLogger(MyApplicationListener.class);

    @Override
    public void onApplicationEvent(WebServerInitializedEvent webServerInitializedEvent) {
        log.info("日志初始化端口号===>{}", webServerInitializedEvent.getWebServer().getPort());
    }
}
